/*
 * @FilePath: /tads/server/core/sdk/runtime/application.go
 * @Author: wnina0x0
 * @Date: 2025-04-09 18:09:09
 * @Description:
 *
 * 版权信息 : 2025 by wnina0x0, All Rights Reserved.
 */
package runtime

import (
	"sync"

	"gorm.io/gorm"
)

type Application struct {
	dbs map[string]*gorm.DB
	mux sync.RWMutex
}

func (s *Application) SetGorm(key string, db *gorm.DB) {
	s.mux.Lock()
	defer s.mux.Unlock()
	s.dbs[key] = db
}

func (s *Application) GetGorm(key string) *gorm.DB {
	s.mux.Lock()
	defer s.mux.Unlock()
	return s.dbs[key]
}

func NewConfig() *Application {
	return &Application{
		dbs: make(map[string]*gorm.DB),
	}
}
